<ui:composition template="/WEB-INF/templates/defaultLayout.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	<ui:define name="title">
		#{lang.getTrans("ui.mobile.enterprise.title")} 
	</ui:define>

	<ui:define name="layoutCenter">
		<h:form>
			<p:growl id="growl" showDetail="true"/>
			<p:panel id="panel" header="#{lang.getTrans('ui.mobile.enterprise.cadastre')}">
				<h:panelGrid columns="2">
					<h:outputLabel value="#{lang.getTrans('ui.mobile.enterprise.name')}" for="cdEnterprise" />
					<p:inputText id="cdEnterprise" value="#{enterpriseBean.enterprise.cdEnterprise}" 
						requiredMessage="#{lang.getTrans('ui.mobile.enterprise.name.obrigatorio')}"
						size="50" maxlength="120" />
					
					<h:outputLabel value="#{lang.getTrans('ui.mobile.enterprise.cnpj')}" for="cdCNPJ" />
					<p:inputMask mask="99.999.999/9999-99" id="cdCNPJ" value="#{enterpriseBean.enterprise.cdCNPJ}" 
						requiredMessage="#{lang.getTrans('ui.mobile.enterprise.cnpj.obrigatorio')}"
						size="50" maxlength="120"/>

					<h:outputLabel value="#{lang.getTrans('ui.mobile.enterprise.address')}" for="cdAddress" />
					<p:inputText id="cdAddress" value="#{enterpriseBean.enterprise.cdAddress}" 
						requiredMessage="#{lang.getTrans('ui.mobile.enterprise.address.obrigatorio')}"
						size="50" maxlength="120" />
					
					<h:outputLabel value="#{lang.getTrans('ui.mobile.enterprise.neighborhood')}" for="cdNeighborhood" />
					<p:inputText id="cdNeighborhood" value="#{enterpriseBean.enterprise.cdNeighborhood}" 
						requiredMessage="#{lang.getTrans('ui.mobile.enterprise.neighborhood.obrigatorio')}"
						size="50" maxlength="120" />

					<h:outputLabel value="#{lang.getTrans('ui.mobile.enterprise.city')}" for="cdCity" />
					<p:inputText id="cdCity" value="#{enterpriseBean.enterprise.cdCity}" 
						requiredMessage="#{lang.getTrans('ui.mobile.enterprise.city.obrigatorio')}"
						size="50" maxlength="120" />
					
					<h:outputLabel value="#{lang.getTrans('ui.mobile.enterprise.phone')}" for="cdPhone" />
					<p:inputMask mask="(99) 9999-9999" id="cdPhone"
						value="#{enterpriseBean.enterprise.cdPhone}" 
						requiredMessage="#{lang.getTrans('ui.mobile.enterprise.phone.obrigatorio')}"
						size="50" maxlength="120" />
					
					<h:outputLabel value="#{lang.getTrans('ui.mobile.enterprise.usergroup')}" for="cdUserGroup" />
					<p:inputText id="cdUserGroup"
						value="#{enterpriseBean.userGroup.cdUserGroup}" 
						requiredMessage="#{lang.getTrans('ui.mobile.enterprise.usergroup.obrigatorio')}"
						size="50" maxlength="120" />
					
					<h:outputLabel value="#{lang.getTrans('ui.mobile.enterprise.usergroup.description')}" for="dsUserGroup" />
					<p:inputTextarea id="dsUserGroup"
						value="#{enterpriseBean.userGroup.dsUserGroup}" required="true"
						requiredMessage="#{lang.getTrans('ui.mobile.enterprise.usergroup.description.obrigatorio')}"
						cols="50" rows="10" />				
					
					<h:outputLabel value="#{lang.getTrans('ui.mobile.enterprise.user.name')}" for="cdUser" />
					<p:inputText id="cdUser" value="#{enterpriseBean.user.cdUser}"
						required="true" size="50" maxlength="70"
						requiredMessage="#{lang.getTrans('ui.mobile.enterprise.user.name.obrigatorio')}"/>

					<h:outputLabel value="#{lang.getTrans('ui.mobile.enterprise.user.login')}"
						for="cdLogin" />
					<p:inputText id="cdLogin" value="#{enterpriseBean.user.cdLogin}"
						required="true" size="30" maxlength="50"
						requiredMessage="#{lang.getTrans('ui.mobile.enterprise.user.login.obrigatorio')}"/>

					<h:outputLabel value="#{lang.getTrans('ui.mobile.enterprise.user.password')}"
						for="cdPassword" />
					<p:password id="cdPassword" value="#{enterpriseBean.user.cdPassword}"
						requiredMessage="#{lang.getTrans('ui.mobile.enterprise.user.password.obrigatorio')}"
						required="true" size="30" maxlength="50" />

					<h:outputLabel value="#{lang.getTrans('ui.mobile.enterprise.user.confirm.password')}"
						for="cdConfirmPassword" />
					<p:password id="cdConfirmPassword" value="#{enterpriseBean.user.cdConfirmPassword}" size="30"
						required="true" maxlength="50" 
						requiredMessage="#{lang.getTrans('ui.mobile.enterprise.user.confirm.password.obrigatorio')}"/>

				</h:panelGrid>
			</p:panel>
			<p:blockUI block="panel" trigger="btSub"/>
			<p:panel style="text-align:center">
				<h:inputHidden id="idEnterprise" value="#{enterpriseBean.enterprise.idEnterprise}" />
				<h:inputHidden id="nrVersion" value="#{enterpriseBean.enterprise.nrVersion}" />		
				<p:commandButton id="btSub" value="#{lang.getTrans('ui.mobile.common.save')}"
					type="submit" action="#{enterpriseBean.adicionar}" update="growl"/>
				<p:button value="#{lang.getTrans('ui.mobile.common.cancel')}" outcome="enterprise" />
			</p:panel>
		</h:form>
	</ui:define>
</ui:composition>
